package com.job.shuang.HomeWork0711.SingletonPattern;

import com.job.shuang.HomeWork0711.SingletonPattern.Premier;

/**
 * @author Liushuang
 * @version 1.0
 * @since 2022-07-11 20:55:27
 */
public class TestPremier {
    public static void main(String[] args) {

        //final修饰的局部变量
        final double PI=3.14;
        //PI=3.15;//Cannot assign(标识) a value to final variable 'PI'

        System.out.println(Premier.number);
        //三个小时都没用到过单例对象，而一直在用number

        Premier premier1=Premier.GetInstance();
        Premier premier2=Premier.GetInstance();
        Premier premier3=Premier.GetInstance();
        System.out.println(premier1==premier2&&premier1==premier3);//比较地址

        premier1.setName("小安");
        System.out.println(premier2.getName());
        System.out.println(premier3.getName());
    }
}
